// pages/scan/scan.js
import API from '../../utils/api.js'
const App = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    name: "",
    image_url: "",
    description: "",
    navList: ['识别', '常见问题', '生病', '养宠经验', '动态', '圈子'],
    num: 0,
    left: '4.5%',
    scroll_height: 0
  },
  navTab(e) {
    var index = e.currentTarget.dataset.index
    console.log(index)
    var left = '4.5%'
    if (index == 0) {
      left = '4.5%'
    } else if (index == 1) {
      left = '21.5%'
    } else if (index == 2) {
      left = '38%'
    } else if (index == 3) {
      left = '54.5%'
    } else if (index == 4) {
      left = '71%'
    } else {
      left = '88%'
    }
    this.setData({
      num: index,
      left: left
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var name = wx.getStorageSync('name');
    var image_url = wx.getStorageSync('image_url');
    var description = wx.getStorageSync('description');
    var name = options.name;
    let windowHeight = wx.getSystemInfoSync().windowHeight // 屏幕的高度
    let windowWidth = wx.getSystemInfoSync().windowWidth // 屏幕的宽度
    let height = App.globalData.navHeight
    this.setData({
      scroll_height: windowHeight * 750 / windowWidth - 110 - 30,
      name:name,
      image_url:image_url,
      description: description
    })
   
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})